package org.me.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Mod1 implements EntryPoint {

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		final Button button = new Button("Click me");
		final Label label = new Label();
		final TabPanel tabPanel = new TabPanel();
		final VerticalPanel verticalPanel = new VerticalPanel();

		button.addClickListener(new ClickListener() {
			public void onClick(Widget sender) {
				if (label.getText().equals("")) {
					label.setText("Hello World! Hello indeeeeeeed");
					label
							.setText(String
									.valueOf(0.0 / 0.0/* com.me.client.FF_ex_1_Varias.calculaVdadoQyD(200.0,200.0) */));
				} else
					label.setText("");
			}
		});

		// Assume that the host HTML has elements defined whose
		// IDs are "slot1", "slot2". In a real app, you probably would not want
		// to hard-code IDs. Instead, you could, for example, search for all
		// elements with a particular CSS class and replace them with widgets.
		//
		tabPanel.setStyleName("myStyles");
		tabPanel.add(verticalPanel, "vp");
		tabPanel.add(new HTML("Foo"), "foo");
		tabPanel.add(new HTML("Bar"), "bar");
		tabPanel.selectTab(0);
		verticalPanel.add(button);
		verticalPanel.add(label);
		verticalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_CENTER);
		verticalPanel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_CENTER);
		RootPanel.get("slot2").add(tabPanel);
	}
}
